# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=corectrl
pkgver=1.2.3
pkgrel=1
pkgdesc="Control your hardware with application profiles"
url="https://gitlab.com/corectrl/corectrl"
arch="all !armhf" # qt5-qtdeclarative
arch="$arch !s390x !riscv64" # kauth-dev
license="GPL-3.0-only"
depends="procps hwids qt5-qtquickcontrols2 qt5-qtsvg qt5-qtxmlpatterns"
makedepends="cmake extra-cmake-modules qt5-qtbase-dev kauth-dev karchive-dev
	botan-dev qt5-qtquickcontrols2-dev qt5-qtcharts-dev qt5-qttools-dev qt5-qtsvg-dev"
source="https://gitlab.com/corectrl/corectrl/-/archive/v$pkgver/corectrl-v$pkgver.tar.gz
	"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_TESTING=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="
47cec510942a8aff7abf375eed0a0061caa477710bed24d3766216c1b1551fbb31917bf3735b534a048e4f299a56537e5aacf4bbea948a8026d0846e045f2ddf  corectrl-v1.2.3.tar.gz
"
